package com.dmc.hrl.controller;

import com.dmc.hrl.domain.entity.Result;
import com.dmc.hrl.domain.entity.ResultEntity;
import com.dmc.hrl.domain.model.HomeContent;
import com.dmc.hrl.service.HomeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.omg.CORBA.Request;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * Created by DMCHRL on 2019/10/10.
 */
@RestController
@Api( tags = {"首页"}, description = "测试模块")
@CrossOrigin
@RequestMapping("/home")
public class HomeController {

    @Autowired
    private HomeService homeService;

    @GetMapping("/initHome")
    @ApiOperation(value = "获取首页数据", notes = "获取首页数据")
    public Result<HomeContent> findAll(){
        return ResultEntity.ok(homeService.initHome());
    }

    @RequestMapping(value = "/getGoods",method = RequestMethod.POST)
    @ApiOperation(value = "获取商品数据", notes = "获取商品数据")
    public Result<HomeContent> getGoodLists(){
        System.out.print("getGoods = ");
        return ResultEntity.ok(homeService.getGoods());
    }

}
